From: Florian Müllner Date: Wed, 1 Jul 2020 15:15:48 +0000 (+0200) Subject: status/system: Add separate 'Restart' item X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~49 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=263320696e639ec3c2492736fa7873e27e34567d;p=gnome-shell.git status/system: Add separate 'Restart' item A side effect of removing the action buttons in favor of a regular submenu is that we are a lot less constrained by size. So instead of lumping "Restart" in with "Power Off", make it a separate menu item. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2202 --- diff --git a/js/ui/status/system.js b/js/ui/status/system.js index c5673913e..6f71109c5 100644 --- a/js/ui/status/system.js +++ b/js/ui/status/system.js @@ -27,6 +27,8 @@ class Indicator extends PanelMenu.SystemIndicator { () => this._updateSessionSubMenu()); this._powerOffItem.connect('notify::visible', () => this._updateSessionSubMenu()); + this._restartItem.connect('notify::visible', + () => this._updateSessionSubMenu()); // Whether shutdown is available or not depends on both lockdown // settings (disable-log-out) and Polkit policy - the latter doesn't // notify, so we update the menu item each time the menu opens or @@ -52,6 +54,7 @@ class Indicator extends PanelMenu.SystemIndicator { this._loginScreenItem.visible || this._logoutItem.visible || this._suspendItem.visible || + this._restartItem.visible || this._powerOffItem.visible; } @@ -124,6 +127,17 @@ class Indicator extends PanelMenu.SystemIndicator { this._suspendItem, 'visible', bindFlags); + item = new PopupMenu.PopupMenuItem(_('Restart…')); + item.connect('activate', () => { + this.menu.itemActivated(BoxPointer.PopupAnimation.NONE); + this._systemActions.activateRestart(); + }); + this._sessionSubMenu.menu.addMenuItem(item); + this._restartItem = item; + this._systemActions.bind_property('can-restart', + this._restartItem, 'visible', + bindFlags); + item = new PopupMenu.PopupMenuItem(_('Power Off…')); item.connect('activate', () => { this.menu.itemActivated(BoxPointer.PopupAnimation.NONE);